import { useState, useDeferredValue, useTransition } from 'react';
import SearchResults from './SearchResults';

export default function App() {
  const [text, setText] = useState('');
  const [pending, startTransition] = useTransition()
  
  function onchange(e: any) {
    startTransition(() => {
      setText(e.target.value)
    })
  }

  return (
    <>
      <input onChange={onchange} />
      {pending ? <div>输入中...</div> : <div>输入完成</div>}
      <SearchResults query={text} />
    </>
  );
}
